fix(ui5-shellbar): ignore non-ShellBarItem children in overflow calculation#13729
Merged
Merged
Conversation
…lation
A stray element in the default slot (e.g. a bare <span>) was included in
the overflow algorithm. Without _id / stableDomRef, every recalculation
wrote undefined back into reactive properties and re-rendered the wrapper
with key={undefined}, so widths never converged and RenderQueue threw
"Web component processed too many times this task, max allowed is: 10"
when resizing across the overflow breakpoint.
Filter `this.items` through a new `isInstanceOfShellBarItem` checker at
every read site (overflow algorithm, items-overflow-state update, and
template), so only real ui5-shellbar-item instances participate in the
overflow calculation and the rendered wrapper list.
Adds a Cypress regression test that oscillates viewports across the
overflow breakpoint with a stray <span> in the default slot and asserts
no "processed too many times" error fires.
- Combine ShellBarItem default+named import in ShellBar.ts - Inline 'export const isInstanceOfShellBarItem = createInstanceChecker(...)' in ShellBarItem.ts to match the pattern used by MenuItem, SideNavigationItem, UserSettingsAppearanceViewGroup, etc. Addresses review feedback on #13729.
|
🚀 Deployed on https://pr-13729--ui5-webcomponents-preview.netlify.app |
PetyaMarkovaBogdanova
approved these changes
Jun 24, 2026
|
🧹 Preview deployment cleaned up: https://pr-13729--ui5-webcomponents.netlify.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Placing a non-
ShellBarItemelement (e.g. a bare<span>) inui5-shellbar's default slot alongside the normal items causes resize to throw an uncaught error once the ShellBar's width crosses the overflow breakpoint a few times:Minimal repro:
Verified in Chrome: oscillating the ShellBar's width between ~320 px and ~700 px (i.e. across the overflow breakpoint) reliably fires the
RenderQueueerror.Root cause
The default
itemsslot is typedHTMLElement, so the stray<span>lands inthis.items. The overflow algorithm inShellBarOverflow.buildActionsand the items-overflow-state loop inShellBar.handleUpdateOverflowResultthen assume every entry is aShellBarItemand readitem._id/item.stableDomRef. On a bare<span>both areundefined, so:buildActionscreates a hidable entry withid: undefinedandselector: '[data-ui5-stable="undefined"]'— a selector that never matches anything in shadow DOM.hiddenItemsIdsends up containingundefinedand is written back into the reactivehiddenItemsIdsproperty, which invalidates the component and re-enters the render queue inside the same task.ShellBarTemplate.tsxrenders<div key={item._id} …>for the span — i.e.key={undefined}— so the wrapper churns on every pass and widths never converge.After 10 re-entries
RenderQueuethrows (MAX_PROCESS_COUNT = 10).Fix
Introduce an
isInstanceOfShellBarItemduck-typing checker (matching the existingcreateInstanceCheckerpattern used across the repo) and a single_validItemsaccessor onShellBarthat filtersthis.itemsthrough it. Every read site that previously walkedthis.itemsfor overflow purposes now goes through_validItems:ShellBar.updateOverflow—customItemspassed to the algorithmShellBar.handleUpdateOverflowResult— theinOverflowupdate loopShellBar.overflowItems— what the overflow popover rendersShellBarTemplate.tsx— the custom-items.map(also kills thekey={undefined}churn)The
<span>(or any non-ShellBarItemstray element) still ends up in the light DOM, it's just ignored by the overflow algorithm and the template — which is the correct behavior for a slot documented to acceptui5-shellbar-item.Test
Added a Cypress regression test in
packages/fiori/cypress/specs/ShellBar.cy.tsxthat mounts the failing markup, oscillates the viewport across the overflow breakpoint, and asserts noprocessed too many timeserror fires.Full ShellBar Cypress suite: 67 passing, 0 failing locally.
Out of scope
Could also tighten the slot type from
HTMLElementtoShellBarItemso the framework rejects strays at assignment time. Left for a separate change in case anything relies on the looser slot contract.